<section class="header clearfix">
  <div class="pull-left">
    <h1>
      {{#if editing}}
        {{t "projectsPage.editProject"}}
      {{else}}
        {{t "projectsPage.addProject"}}
      {{/if}}
    </h1>
  </div>
</section>

<section class="horizontal-form container-fluid">
  {{form-name-description
    model=model.project
    nameLabel="projectsPage.name.label"
    nameRequired=true
    namePlaceholder="projectsPage.name.placeholder"
  }}
  {{#if model.project.cluster.capabilities.pspEnabled}}
    <label class="acc-label">
      {{t "projectsPage.psp.label"}}
    </label>
    {{new-select
      content=model.psps
      optionLabelPath="displayName"
      optionValuePath="id"
      prompt="generic.none"
      localizedPrompt=true
      value=podSecurityPolicyTemplateId
    }}
  {{/if}}
</section>

<div class="row">
  {{#accordion-list showExpandAll=false as | al expandFn | }}
    <div class="col span-12">
      {{#accordion-list-item
         title=(t "projectsPage.members.title")
         detail=(t "projectsPage.members.detail")
         status=(t "pagination.member" pages=1 count=memberArray.length)
         statusClass=(if memberArray.length "text-success" "text-error")
         expandAll=al.expandAll
         expand=(action expandFn)
         expandOnInit=true
      }}
        {{form-members
          creator=creator
          editing=(or editing isNew)
          expanded=expanded
          isNew=isNew
          errors=memberErrors
          memberConfig=memberConfig
          primaryResource=primaryResource
          registerHook=(action "registerHook")
          roles=model.roles
          type="project"
          users=model.users
        }}
      {{/accordion-list-item}}

      {{#accordion-list-item
         title=(t "projectsPage.resourceQuota.title")
         detail=(t "projectsPage.resourceQuota.detail")
         expandAll=al.expandAll
         expand=(action expandFn)
         expandOnInit=false
      }}
        {{project-resource-quota
          editing=(or editing isNew)
          expanded=expanded
          limit=primaryResource.resourceQuota.limit
          nsDefaultLimit=primaryResource.namespaceDefaultResourceQuota.limit
          changed=(action "updateQuota")
        }}
      {{/accordion-list-item}}

      {{#accordion-list-item
         title=(t "projectsPage.containerDefaultLimit.title")
         detail=(t "projectsPage.containerDefaultLimit.detail")
         expandAll=al.expandAll
         expand=(action expandFn)
         expandOnInit=false
      }}
        {{container-default-limit
          editing=(or editing isNew)
          expanded=expanded
          limit=primaryResource.containerDefaultResourceLimit
          changed=(action "updateContainerDefault")
        }}
      {{/accordion-list-item}}

      {{form-labels-annotations
        classNames="accordion-wrapper"
        detailKey="projectsPage.annotationsDetail"
        expandAll=al.expandAll
        expandFn=expandFn
        initialLabels=primaryResource.labels
        model=primaryResource
      }}
    </div>
  {{/accordion-list}}
</div>

{{top-errors errors=errors}}
{{top-errors errors=memberErrors}}
{{save-cancel
  editing=editing
  save=(action "save")
  cancel=(action "cancel")
}}
